package com.zq.learing.base.实用;

import java.io.File;

/**
 * @Author: zhaoqi
 * @Date: 11/13/2019 12:51 AM
 * @Version 1.0
 * 打印文件下下的所有文件名称
 */

public class PrintFileName {

    public static void main(String[] args) {
        File file = new File("E://360驱动大师目录//");
        PrintFileName fi = new PrintFileName();
        fi.testPrint(file);

    }

    private void testPrint(File file) {
        String name = file.getName();
        Boolean b = file.isDirectory();
        if (b){
            File file1[] = file.listFiles();
            for (File file2 : file1) {
                testPrint(file2);
            }
        }else {
            System.out.println(file.getAbsoluteFile());
        }

    }
}
